package principle.liskovSubstitutionPrinciple.origin;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author： pang-yun
 * @date： 2021-08-24 19:23
 * 功能目的 ：用于 模拟信用卡
 */
//复用了父类的核心代码  但是也破坏了其结构
public class Credit extends CashCard {
    private Logger logger = LoggerFactory.getLogger(Credit.class);

    @Override
    public String withdrawal(String orderId, BigDecimal amount) {
        // 校验
        if (amount.compareTo(new BigDecimal(1000))>=0){
            logger.info("sorry 限额1000");
            return "0001";
        }
        logger.info("贷款成功");
        return "0001";
    }

    @Override
    public String recharge(String orderId, BigDecimal amount) {
       //还款
        logger.info("还款成功！");
        return "0000";
    }

    @Override
    public List<String> tradeFlow() {
        return super.tradeFlow();
    }
}
